Usage
The following table describes the behavior of the Inject Conditional Header Connector based on the input configuration:
| Pre/ Post | Scenario | Input Configuration | Response Code | Expected Output |
|---|---|---|---|---|
| Pre/Post | Empty Request/Response Header | RequestHeaders: or ResponseHeaders: | NA | Request/Response is processed but no header is added in the request/response. |
| Pre/Post | Different Headers | RequestHeaders:[{"header": "Accept: application/json"},{"header":"Cache-Control:no-cache"}] or ResponseHeaders:[{"header": "Accept: application/json"},{"header":"Cache-Control:no-cache"}] | NA | The following headers are added in the request/response: - Accept=application/json - Cache-Control=no-cache |
| Pre/Post | Same Header with Different Values | RequestHeaders:[{"header": "Accept: application/json"},{"header":"Accept: application/xml"}] or ResponseHeaders:[{"header": "Accept: application/json"},{"header":"Accept: application/xml"}] | NA | The following headers are added in the request/response: - Accept=application/json - Accept=application/xml |
| Pre/Post | Same Header with Same Value | RequestHeaders:[{"header": "Accept: application/json"},{"header":"Accept: application/json"}] or ResponseHeaders: [{"header": "Accept: application/json"},{"header":"Accept: application/json"}] | NA | The following header is added once in the request/response: Accept=application/json |
| Pre/Post | Invalid Json Input | RequestHeaders:[{"header": "Accept: application/json"] or ResponseHeaders:[{"header": "Accept: application/json"] | NA | Request is processed but no header is added in the request/response. |
| Pre/Post | Two semicolons are present in header value in place of one semicolon. | RequestHeaders:[{"header": "Accept: application/json : application/xml"}] or ResponseHeaders:[{"header": "Accept: application/json : application/xml"}] | NA | The following header is added in the request/response: Accept=application/json : application/xml |
| Pre/Post | Header Value is not specified in the configuration | RequestHeaders:[{"header": "Accept:"}] or ResponseHeaders:[{"header": "Accept:"}] | NA | The following header is added in the request/response: Accept= |
| Pre/Post | Empty Header tag is specified | RequestHeaders:[{"header": ""}] or ResponseHeaders:[{"header": ""}] | NA | Request/Response is processed but no header is added in the request/response. |
| Pre/Post | Invalid Header Format specified | RequestHeaders:[{"header": "Accept=applicaton/json"}] or ResponseHeaders:[{"header": "Accept=applicaton/json"}] | NA | Request/Response is processed but no header is added in the request/response. |
| Pre/Post | Incorrect Header tag name | RequestHeaders:[{"header\_name": "Accept:applicaton/json"}] or ResponseHeaders:[{"header\_name": "Accept:applicaton/json"}] | NA | Request/Response is processed but no header is added in the request/response. |
| Pre | Invalid tag present in configuration | RequestHeaders:[{"header": "Accept:applicaton/json", "httpStatusCode\_1":"200,500"}] | NA | The following header is added in the request: Accept=application/json |
| Post | Status Code condition specified in post input and matched in the response. | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","httpStatusCode": "500,504"}] | 500 | The following header is added in the response: X-Content-Type-Options=nosniff |
| Post | Status Code condition specified in post input and is not matched in the response. | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","httpStatusCode": "500,504"}] | 200 | No header is added in the response. |
| Post | Empty httpStatusCode is specified | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","httpStatusCode": ""}] | 400 | No header is added in the response irrespective of response code. |
| Post | Invalid httpStatusCode specified in post input. | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","httpStatusCode": "500,504,xxx"}] | 500 | The header is added for response code 500 and 504: X-Content-Type-Options=nosniff |
| Post | Invalid httpStatusCode Tag Name | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","httpStatusCode\_1": "500,504"}] | 500 | No header is added in the response irrespective of response code. |
| Post | Invalid tag present in post-input | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","conditions": "{"httpStatusCode":"200"}"}] | 200 | No header is added in the response irrespective of response code. |
| Post | HttpStatusCode tag is not specified in the configuration. | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","":"200"}] | 200 | No header is added in the response irrespective of response code. |
| Post | HttpStatusCode range specified | ResponseHeaders:[{"header": "X-Content-Type-Options: nosniff","httpStatusCode":"500,504,2xx"}] | 210 | The following header is added for response code - 500, 504 and 2xx series: X-Content-Type-Options=nosniff |